<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<p:dataTable var="product" value="#{productModel.list}" filteredValue="#{productModel.filteredList}" filterEvent="enter"
		resizableColumns="false" rowKey="#{product.id}"
		selection="#{productModel.current}" selectionMode="single"
		paginator="true" paginatorAlwaysVisible="false" paginatorPosition="top" rows="30" rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,200"
		paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">

		<p:column headerText="Supplier" sortBy="#{product.supplier.name}"
			filterBy="#{product.supplier.name}" filterMatchMode="contains">
			<h:outputText value="#{product.supplier.name}" />
		</p:column>
		<p:column sortBy="#{product.number}" style="width:65px">
			<f:facet name="header">
				<p:commandButton ajax="true" update=":detailForm"
					actionListener="#{productController.initWithoutCheck}"
					value="Reload" style=" font-size:0.9em;float:left"></p:commandButton>
			</f:facet>
			<h:outputText value="#{product.number}" />
		</p:column>
		<p:column  sortBy="#{product.chineseName}"
			filterBy="#{product.chineseName}" filterMatchMode="contains">
			<h:outputText value="#{product.chineseName}" />
		</p:column>
		<p:column  sortBy="#{product.name}"
			filterBy="#{product.name}" filterMatchMode="contains">
			<h:graphicImage library="images" value="../#{product.icon}16.png"></h:graphicImage>
			<h:outputText value="#{product.name}" />
		</p:column>
		<p:column sortBy="#{product.type.label}"
			filterBy="#{product.type.label}" filterMatchMode="contains"
			style="width:80px">
			<h:outputText value="#{product.type.label}" />
		</p:column>
		<p:column headerText="price" sortBy="#{product.price}"
			style="width:70px">
			<h:outputText value="#{product.price}" />
		</p:column>
		<p:column headerText="Special price" sortBy="#{product.specialPrice}"
			style="width:100px">
			<h:outputText value="#{product.specialPrice}" />
		</p:column>
		<p:column headerText="Stock unit" >
			<h:outputText value="#{product.stockUnit}/#{product.chineseStockUnit}/#{product.frenchStockUnit}" />
		</p:column>
		<p:column headerText="Spec. desc.">
			<h:outputText value="#{product.specificationDescLabel}" />
		</p:column>
		<p:column headerText="inventory" sortBy="#{product.inventory}"
			style="width:70px">
			<h:outputText value="#{product.inventory}" />
		</p:column>
		<p:column style="width:20px">
			<p:commandButton icon="edit" ajax="true"
				oncomplete="editInventoryDlg.show()" update=":dialogForm">
				<f:setPropertyActionListener value="#{product}"
					target="#{productModel.current}" />
			</p:commandButton>
		</p:column>
	</p:dataTable>
</ui:composition>
</html>